package leetcode.N601_N700;

/**
 * @author xiwai [hww282306@alibaba-inc.com]
 * @version 1.0
 * @date 2020/10/20 12:18 下午
 */
public class N674 {

    public static void main(String[] args) {
        int[] nums = {1,3,5,7};
        System.out.println(findLengthOfLCIS(nums));

    }

    public static int findLengthOfLCIS(int[] nums) {
        if (nums.length == 0) {
            return 0;
        }
        int maxLength = 1;
        int lastVal = nums[0];
        int lastLength = 1;
        for (int i = 1; i < nums.length; i++) {
            int currentVal = nums[i];
            if (currentVal > lastVal) {
                lastLength++;
                lastVal = currentVal;
            } else {
                maxLength = Math.max(maxLength, lastLength);
                lastLength = 1;
                lastVal = currentVal;
            }
        }
        return Math.max(maxLength, lastLength);
    }
}
